package com.lagou.order.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lagou.commen.pojo.Order;
import com.lagou.commen.pojo.OrderVO;
import com.lagou.order.mapper.OrderMapper;
import com.lagou.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 李树飞
 */
@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    private OrderMapper orderMapper;

    @Override
    public Order findById(Integer id) {
        return orderMapper.findById(id);
    }

    @Override
    public PageInfo<Order> selectByPage(OrderVO orderVO) {
        //分页
        PageHelper.startPage(orderVO.getCurrentPage(), orderVO.getPageSize());
        List<Order> list = orderMapper.selectByPage(orderVO);
        return new PageInfo<>(list);
    }

    @Override
    public List<Integer> selectGoodsIdListByOrderId(Integer id) {
        return orderMapper.selectGoodsIdListByOrderId(id);
    }
}
